<p>WELCOME <%= Users.find(session[:id]).username %></p>
<h1>My Tasks List</h1>

<% if @list.blank?%>
  <p>
    There are NO TASKS available right now !
  </p>
<%else%>

  <table cellpadding="10" cellspacing="1">

    <ul id="tasks">
      <%=  render :partial => 'tasks', :object => @tasks%>
    </ul>
  </table>
<%end%>


<p id="add_link"><%= link_to_function("Add a New Task",
    "Element.hide('add_link'); Element.show('add_task')")%></p>

<div id="add_task" style="display: none">
  <%= form_tag :action => 'create',:remote=> true do |t| %>

    <label for="task_name">
                  Task name
    </label>:<%= text_field 'new', 'task_name' %>

    <%= hidden_field 'new','user_id', :value => @user_id%>

    <%= submit_tag "Create Task" %>


  <%= link_to_function("Cancel",
    "Element.hide('add_task'); Element.show('add_link')")%>

  <%end%>




</div>

<%= link_to 'Logout', :controller => 'user', :action => 'logout' %>
